/**
 * @Author yinyunqi
 * @date 2018年2月2日
 * @Content 
 */
package com.yongqi.controller.back;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.yongqi.service.FamilyService;
import com.yongqi.service.back.EmailService;
import com.yongqi.service.back.MessageService;
import com.yongqi.service.back.TimerTaskService;

@Controller
@RequestMapping("/backMain")
public class BackMainController {
    @Autowired
    FamilyService familyService;
    @Autowired
    EmailService emailService;
    @Autowired
    MessageService messageService;
    @Autowired
    TimerTaskService timerTaskService;
    /**
     * 后台管理iframe主页面
     * @return
     */
    @RequestMapping("/main")
    public String backMain(Model model) {
	//家庭用户总数
	Map<String, String> map = new HashMap<String, String>();
	int familyTotal = familyService.backFamilyQuery(map).size();
	//邮件总数
	int emailTotal = emailService.backEmailQuery(map).size(); 
	//推送消息总数
	int msgTotal = messageService.backMsgQuery(map).size();
	//定时任务总数
	int taskTotal = timerTaskService.backTimerTaskQuery(map).size();
	model.addAttribute("familyTotal", familyTotal);
	model.addAttribute("emailTotal", emailTotal);
	model.addAttribute("msgTotal", msgTotal);
	model.addAttribute("taskTotal", taskTotal);
	return "back/back_main";
    }
}

